Full source code website bán hàng thương mại điện tử gần giống shopee
468.961 lượt xem;
1 <?php
2 include("../ckeditor/ckeditor.php");
3 ?>
4 <script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
5 <script type="text/javascript" src="../ckeditor/ckfinder/ckfinder.js"></script>
6 <?
7 $path="../upload";
8 $pathdb="upload";
9
10 if (isset($_POST['butSaveLoai'])) {
11 $id=$_POST['ddContent'];
12 $desc=$_POST['txtDesc'];
13 $link=$_POST['txtDescen'];
14 $imageSmall=$_FILES['txtImage'];
15
16 $err="";
17 $err.=CheckUpload($_FILES["txtImage"],".jpg;.gif;.swf;.bmp;.avi;.wma;.dat;.mp3;.wmv",3000*1024,0);
18
19 if ($err=="")
20 {
21 if (mysql_query("update info set content='".$desc."',link='".$link."' where id='".$id."'",$con)) {
22 if ($_POST['chkClear']=='')
23 {
24 $sqlUpdateField = "";
25 $extsmall=GetFileExtention($_FILES['txtImage']['name']);
26 if (MakeUpload($_FILES['txtImage'],"$path/content_s$id$extsmall"))
27 {
28 @chmod("$path/content_s$id$extsmall", 0777);
29 $sqlUpdateField = " image='$pathdb/content_s$id$extsmall' ";
30 }
31
32 }
33 else
34 {
35 $pro=GetContentInfo($id);
36 if (file_exists("../".$pro['image'])) unlink("../".$pro['image']);
37 $sqlUpdateField = " image='' ";
38 }
39 if($sqlUpdateField)
40 {
41 $sqlUpdate = "update info set $sqlUpdateField where id='".$id."'";
42 mysql_query($sqlUpdate,$con);
43 }
44 }
45 else {
46 $err = "<p align=center class='err'>Không thể cập nhật</p>";
47 }
48 if ($err=='') echo "<p align=center class='err'>Đã cập nhật thành công</p>";
49 //if ($err=='') echo '<script>window.location="index.php?act=content&id='.$_REQUEST['id'].'&code=1"</script>';
50 }
51 if ($err!="") echo "<p align=center class='err'>".$err."</p>";
52 }
53 $id=1;
54 if ($_REQUEST['id']!='') $id=$_REQUEST['id'];
55 $cont=GetContentInfo($id);
56 $desc=$cont['content'];
57 $link=$cont['link'];
58 ?>
59
60
61 <form method="post" name="FormLoaiSP" enctype="multipart/form-data" action="index.php?">
62 <input type="hidden" name="act" value="content">
63 <input type="hidden" name="id" value="<? echo $_REQUEST['id']; ?>">
64 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
65 <tr>
66 <td width="45%" class="title" align="center">Cập nhật: Nội dung</td>
67 </tr>
68 <tr>
69 <td width="45%">
70 <table border="0" cellpadding="2" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
71 <tr>
72 <td width="99%" class="smallfont" colspan="4" align="center">
73 <? if ($cont['image']!='') { ?>
74 <img border="0" src="../<? echo $cont['image']; ?>">
75 <? } ?>
76 </td>
77 </tr>
78 <tr>
79 <td width="15%" class="smallfont">
80 <p align="right">Chọn nội dung</td>
81 <td width="1%" class="smallfont" align="center">
82 <font color="#FF0000">*</font></td>
83 <td width="4%" class="smallfont">
84 <select size="1" name="ddContent">
85 <?
86 $list=GetListContent();
87 $id=$_REQUEST['id'];
88 foreach ($list as $c)
89 {
90 if ($id=="") $id=$c[0];
91 if ($c[0]!==$_REQUEST['id'])
92 echo '<option value="'.$c[0].'">'.$c[1].'</option>';
93 else
94 echo '<option selected value="'.$c[0].'">'.$c[1].'</option>';
95 }
96 ?>
97 </select></td>
98 <td width="79%" class="smallfont">
99 <input type="button" value="Chuyển" name="B1" class="button" onclick="javascript:window.location='./?act=content&id='+ddContent.value"></td>
100 </tr>
101 <tr>
102 <td width="15%" class="smallfont" align="right">
103 Hình ảnh</td>
104 <td width="1%" class="smallfont" align="center">
105 </td>
106 <td width="83%" class="smallfont" colspan="2">
107 <INPUT TYPE="file" NAME="txtImage" CLASS=textbox size="34"><input type="checkbox" name="chkClear" value="ON">Xóa
108 bỏ hình</td>
109 </tr>
110
111 <?if($_REQUEST['id']==8){?>
112 <tr>
113 <td width="15%" class="smallfont" align="right">
114 Người nhận</td>
115 <td width="1%" class="smallfont" align="center">
116 </td>
117 <td width="83%" class="smallfont" colspan="2">
118 <textarea rows="2" name="txtDescen" cols="60"><? echo $link; ?></textarea>
119 </td></tr>
120 <?} else {?>
121 <tr>
122 <td width="15%" class="smallfont" align="right">
123 Link</td>
124 <td width="1%" class="smallfont" align="center">
125 </td>
126 <td width="83%" class="smallfont" colspan="2">
127
128 <input type="text" name="txtDescen" value="<? echo $link; ?>" style="width:500px">
129
130 </td>
131 </tr>
132 <?}?>
133
134
135 <?if($_REQUEST['id']==8){?>
136 <tr>
137 <td width="15%" class="smallfont" align="right">
138 Người nhận</td>
139 <td width="1%" class="smallfont" align="center">
140 </td>
141 <td width="83%" class="smallfont" colspan="2">
142 <textarea rows="2" name="txtDesc" cols="60"><? echo $desc; ?></textarea>
143 </td></tr>
144 <?} else {?>
145 <tr>
146 <td width="15%" class="smallfont" align="right">
147 Nội dung</td>
148 <td width="1%" class="smallfont" align="center">
149 </td>
150 <td width="83%" class="smallfont" colspan="2">
151 <p>
152 <textarea name="txtDesc" cols="60" rows="20"><? echo $desc; ?></textarea>
153 </p>
154 <?php
155 $CKEditor = new CKEditor();
156 $CKEditor->basePath = '../ckeditor/';
157 $CKEditor->replace("txtDesc");
158 ?>
159 </td>
160 </tr>
161 <?}?>
162
163
164
165
166
167
168
169 <tr>
170 <td width="15%" class="smallfont" colspan="2">
171 <p align="right">
172 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button onclick="submitForm()"> </td>
173 <td width="84%" class="smallfont" align="center" colspan="2">
174 <p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
175 </tr>
176 </table>
177 </td>
178 </tr>
179 </table>
180 </form>
2 include("../ckeditor/ckeditor.php");
3 ?>
4 <script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
5 <script type="text/javascript" src="../ckeditor/ckfinder/ckfinder.js"></script>
6 <?
7 $path="../upload";
8 $pathdb="upload";
9
10 if (isset($_POST['butSaveLoai'])) {
11 $id=$_POST['ddContent'];
12 $desc=$_POST['txtDesc'];
13 $link=$_POST['txtDescen'];
14 $imageSmall=$_FILES['txtImage'];
15
16 $err="";
17 $err.=CheckUpload($_FILES["txtImage"],".jpg;.gif;.swf;.bmp;.avi;.wma;.dat;.mp3;.wmv",3000*1024,0);
18
19 if ($err=="")
20 {
21 if (mysql_query("update info set content='".$desc."',link='".$link."' where id='".$id."'",$con)) {
22 if ($_POST['chkClear']=='')
23 {
24 $sqlUpdateField = "";
25 $extsmall=GetFileExtention($_FILES['txtImage']['name']);
26 if (MakeUpload($_FILES['txtImage'],"$path/content_s$id$extsmall"))
27 {
28 @chmod("$path/content_s$id$extsmall", 0777);
29 $sqlUpdateField = " image='$pathdb/content_s$id$extsmall' ";
30 }
31
32 }
33 else
34 {
35 $pro=GetContentInfo($id);
36 if (file_exists("../".$pro['image'])) unlink("../".$pro['image']);
37 $sqlUpdateField = " image='' ";
38 }
39 if($sqlUpdateField)
40 {
41 $sqlUpdate = "update info set $sqlUpdateField where id='".$id."'";
42 mysql_query($sqlUpdate,$con);
43 }
44 }
45 else {
46 $err = "<p align=center class='err'>Không thể cập nhật</p>";
47 }
48 if ($err=='') echo "<p align=center class='err'>Đã cập nhật thành công</p>";
49 //if ($err=='') echo '<script>window.location="index.php?act=content&id='.$_REQUEST['id'].'&code=1"</script>';
50 }
51 if ($err!="") echo "<p align=center class='err'>".$err."</p>";
52 }
53 $id=1;
54 if ($_REQUEST['id']!='') $id=$_REQUEST['id'];
55 $cont=GetContentInfo($id);
56 $desc=$cont['content'];
57 $link=$cont['link'];
58 ?>
59
60
61 <form method="post" name="FormLoaiSP" enctype="multipart/form-data" action="index.php?">
62 <input type="hidden" name="act" value="content">
63 <input type="hidden" name="id" value="<? echo $_REQUEST['id']; ?>">
64 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
65 <tr>
66 <td width="45%" class="title" align="center">Cập nhật: Nội dung</td>
67 </tr>
68 <tr>
69 <td width="45%">
70 <table border="0" cellpadding="2" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
71 <tr>
72 <td width="99%" class="smallfont" colspan="4" align="center">
73 <? if ($cont['image']!='') { ?>
74 <img border="0" src="../<? echo $cont['image']; ?>">
75 <? } ?>
76 </td>
77 </tr>
78 <tr>
79 <td width="15%" class="smallfont">
80 <p align="right">Chọn nội dung</td>
81 <td width="1%" class="smallfont" align="center">
82 <font color="#FF0000">*</font></td>
83 <td width="4%" class="smallfont">
84 <select size="1" name="ddContent">
85 <?
86 $list=GetListContent();
87 $id=$_REQUEST['id'];
88 foreach ($list as $c)
89 {
90 if ($id=="") $id=$c[0];
91 if ($c[0]!==$_REQUEST['id'])
92 echo '<option value="'.$c[0].'">'.$c[1].'</option>';
93 else
94 echo '<option selected value="'.$c[0].'">'.$c[1].'</option>';
95 }
96 ?>
97 </select></td>
98 <td width="79%" class="smallfont">
99 <input type="button" value="Chuyển" name="B1" class="button" onclick="javascript:window.location='./?act=content&id='+ddContent.value"></td>
100 </tr>
101 <tr>
102 <td width="15%" class="smallfont" align="right">
103 Hình ảnh</td>
104 <td width="1%" class="smallfont" align="center">
105 </td>
106 <td width="83%" class="smallfont" colspan="2">
107 <INPUT TYPE="file" NAME="txtImage" CLASS=textbox size="34"><input type="checkbox" name="chkClear" value="ON">Xóa
108 bỏ hình</td>
109 </tr>
110
111 <?if($_REQUEST['id']==8){?>
112 <tr>
113 <td width="15%" class="smallfont" align="right">
114 Người nhận</td>
115 <td width="1%" class="smallfont" align="center">
116 </td>
117 <td width="83%" class="smallfont" colspan="2">
118 <textarea rows="2" name="txtDescen" cols="60"><? echo $link; ?></textarea>
119 </td></tr>
120 <?} else {?>
121 <tr>
122 <td width="15%" class="smallfont" align="right">
123 Link</td>
124 <td width="1%" class="smallfont" align="center">
125 </td>
126 <td width="83%" class="smallfont" colspan="2">
127
128 <input type="text" name="txtDescen" value="<? echo $link; ?>" style="width:500px">
129
130 </td>
131 </tr>
132 <?}?>
133
134
135 <?if($_REQUEST['id']==8){?>
136 <tr>
137 <td width="15%" class="smallfont" align="right">
138 Người nhận</td>
139 <td width="1%" class="smallfont" align="center">
140 </td>
141 <td width="83%" class="smallfont" colspan="2">
142 <textarea rows="2" name="txtDesc" cols="60"><? echo $desc; ?></textarea>
143 </td></tr>
144 <?} else {?>
145 <tr>
146 <td width="15%" class="smallfont" align="right">
147 Nội dung</td>
148 <td width="1%" class="smallfont" align="center">
149 </td>
150 <td width="83%" class="smallfont" colspan="2">
151 <p>
152 <textarea name="txtDesc" cols="60" rows="20"><? echo $desc; ?></textarea>
153 </p>
154 <?php
155 $CKEditor = new CKEditor();
156 $CKEditor->basePath = '../ckeditor/';
157 $CKEditor->replace("txtDesc");
158 ?>
159 </td>
160 </tr>
161 <?}?>
162
163
164
165
166
167
168
169 <tr>
170 <td width="15%" class="smallfont" colspan="2">
171 <p align="right">
172 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button onclick="submitForm()"> </td>
173 <td width="84%" class="smallfont" align="center" colspan="2">
174 <p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
175 </tr>
176 </table>
177 </td>
178 </tr>
179 </table>
180 </form>